// 箭头效果
function drawMarkerArrow(defs, strokeColor) {
	var markeName = "markerEndArrow";
	if (strokeColor == passedColor) {
		markeName = "markerEndArrowPassed";
	};
	defs.append("marker")
			.attr("id", markeName)
			.attr("markerUnits","strokeWidth")
			.attr("viewBox","0 0 60 60")
			.attr("refX",30)
			.attr("refY",30)
			.attr("markerWidth",60)
			.attr("markerHeight",60)
			.attr("orient","auto")
			.append("path")
			.attr("stroke-width",1)
			.attr("stroke",strokeColor)
			.attr("fill",strokeColor)
			.attr("opacity",1)
			.attr("d","M 20 27 L30 30 L20 33 z");
};

// 垂直渐变效果
function drawLinearGradient(defs, startColor, endColor) {
	var linearGradient = defs.append("linearGradient")
			.attr("id", "change")
			.attr("x1", "0%")
			.attr("y1", "0%")
			.attr("x2", "0%")
			.attr("y2", "100%");
	linearGradient.append("stop")
		.attr("offset", "0%")
		.attr("stop-color", startColor)
		.attr("stop-opacity", 1);
	linearGradient.append("stop")
		.attr("offset", "100%")
		.attr("stop-color", endColor)
		.attr("stop-opacity", 1);
};

// 放射渐变
function drawRadialGradient(defs, startColor, endColor) {
	var radialGradient = defs.append("radialGradient")
			.attr("id", "change")
			.attr("x1", "0%")
			.attr("y1", "0%")
			.attr("x2", "0%")
			.attr("y2", "100%");
	radialGradient.append("stop")
		.attr("offset", "0%")
		.attr("stop-color", startColor)
		.attr("stop-opacity", 1);
	radialGradient.append("stop")
		.attr("offset", "100%")
		.attr("stop-color", endColor)
		.attr("stop-opacity", 1);
};